package com.adwin.addcoin.repository

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.ObservableSource
import io.reactivex.rxjava3.core.ObservableTransformer
import io.reactivex.rxjava3.schedulers.Schedulers

/**
 * 将子线程处理事件，主线程处理结果
 */
class SchedulerTransformer<D : Any> : ObservableTransformer<D, D> {
    override fun apply(upstream: Observable<D>): ObservableSource<D> {
        return upstream.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
    }
}